package cn.iocoder.yudao.module.member.agency.controller.admin;

import cn.iocoder.yudao.framework.business.basic.controller.DetailController;
import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.agency.service.AdminAgencyOrderService;
import cn.iocoder.yudao.module.member.agency.vo.AdminAgencyOrderQueryDTO;
import cn.iocoder.yudao.module.member.agency.vo.AdminAgencyOrderVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 招商人员身份订单")
@RestController
@RequestMapping("/member/agency-order")
@Validated
public class AgencyOrderController implements DetailController<AdminAgencyOrderVO, Long>, PageController<AdminAgencyOrderVO, AdminAgencyOrderQueryDTO> {
    @Resource
    private AdminAgencyOrderService adminAgencyOrderService;

    @PreAuthorize("@ss.hasPermission('member:agency:order')")
    @Override
    public CommonResult<AdminAgencyOrderVO> getDetail(Long id) {
        return success(adminAgencyOrderService.getDetail(id));
    }

    @PreAuthorize("@ss.hasPermission('member:agency:order')")
    @Override
    public CommonResult<PageResult<AdminAgencyOrderVO>> getPage(Integer pageNo, Integer pageSize, AdminAgencyOrderQueryDTO param) {
        return success(adminAgencyOrderService.getPage(pageNo, pageSize, param));
    }

}